package com.searchschool.bean;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
@Entity (name="ORIGIN")
@Table (name="tborigin")
public class Origin implements Serializable {
	
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue ( strategy=GenerationType.TABLE, generator="ORIGIN_GEN")
	@TableGenerator(name="ORIGIN_GEN", table="tbsequence", pkColumnName="SEQ_NAME", valueColumnName="SEQ_COUNT", pkColumnValue="ORIGIN", allocationSize=1	)
	
	private int idorigin;
	private String nameorigin;
	@OneToOne ( optional=true, cascade=CascadeType.ALL,
		    mappedBy="origin" , targetEntity=School.class
		)
	private School school;
	
	public School getSchool() {
		return school;
	}

	public void setSchool(School school) {
		this.school = school;
	}
	
	public Origin(){
		
	}
	public Origin(int idorigin, String nameorigin) {
		super();
		this.idorigin = idorigin;
		this.nameorigin = nameorigin;
	}
	public int getIdorigin() {
		return idorigin;
	}
	public void setIdorigin(int idorigin) {
		this.idorigin = idorigin;
	}
	public String getNameorigin() {
		return nameorigin;
	}
	public void setNameorigin(String nameorigin) {
		this.nameorigin = nameorigin;
	}
	
	
}
